import request from '@/config/axios'

// 店铺代理商 VO
export interface AgentVO {
  id: number // id
  logo: string // logo
  name: string // 名字
  telephone: string // 联系电话
  startDate: Date // 开始时间
  endDate: Date // 结束时间
}

// 店铺代理商 API
export const AgentApi = {
  // 查询店铺代理商分页
  getAgentPage: async (params: any) => {
    return await request.get({ url: `/shop/agent/page`, params })
  },

  // 查询店铺代理商详情
  getAgent: async (id: number) => {
    return await request.get({ url: `/shop/agent/get?id=` + id })
  },

  // 新增店铺代理商
  createAgent: async (data: AgentVO) => {
    return await request.post({ url: `/shop/agent/create`, data })
  },

  // 修改店铺代理商
  updateAgent: async (data: AgentVO) => {
    return await request.put({ url: `/shop/agent/update`, data })
  },

  // 删除店铺代理商
  deleteAgent: async (id: number) => {
    return await request.delete({ url: `/shop/agent/delete?id=` + id })
  },

  // 导出店铺代理商 Excel
  exportAgent: async (params) => {
    return await request.download({ url: `/shop/agent/export-excel`, params })
  },

// ==================== 子表（店铺管理） ====================

  // 获得店铺管理分页
  getManagePage: async (params) => {
    return await request.get({ url: `/shop/agent/manage/page`, params })
  },
  // 新增店铺管理
  createManage: async (data) => {
    return await request.post({ url: `/shop/agent/manage/create`, data })
  },

  // 修改店铺管理
  updateManage: async (data) => {
    return await request.put({ url: `/shop/agent/manage/update`, data })
  },

  // 删除店铺管理
  deleteManage: async (id: number) => {
    return await request.delete({ url: `/shop/agent/manage/delete?id=` + id })
  },

  // 获得店铺管理
  getManage: async (id: number) => {
    return await request.get({ url: `/shop/agent/manage/get?id=` + id })
  }
}